//
//  ViewController.m
//  10507图片浏览器
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *left;
@property (weak, nonatomic) IBOutlet UILabel *label;

@property (weak, nonatomic) IBOutlet UIButton *right;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
int i = 0;
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)btn2Pressed:(id)sender
{
    NSMutableArray *mArr = [[NSMutableArray alloc]init];
    
    UIImage *image = [UIImage imageNamed:@"biaoqingdi"];
    [mArr addObject:image];
    UIImage *image1 = [UIImage imageNamed:@"bingli"];
    [mArr addObject:image1];
    UIImage *image2 = [UIImage imageNamed:@"chiniupa"];
    [mArr addObject:image2];
    UIImage *image3 = [UIImage imageNamed:@"danteng"];
    [mArr addObject:image3];
    UIImage *image4 = [UIImage imageNamed:@"wangba"];
    [mArr addObject:image4];
    
    self.imageView.animationImages = mArr;
    i++;
    int m = i % 5;
    self.imageView.image = mArr[m];
    self.label.text = [NSString stringWithFormat:@"%i/5",m+1];
}

- (IBAction)btn1Pressed:(id)sender
{
    NSMutableArray *mArr = [[NSMutableArray alloc]init];
    
    UIImage *image = [UIImage imageNamed:@"biaoqingdi"];
    [mArr addObject:image];
    UIImage *image1 = [UIImage imageNamed:@"bingli"];
    [mArr addObject:image1];
    UIImage *image2 = [UIImage imageNamed:@"chiniupa"];
    [mArr addObject:image2];
    UIImage *image3 = [UIImage imageNamed:@"danteng"];
    [mArr addObject:image3];
    UIImage *image4 = [UIImage imageNamed:@"wangba"];
    [mArr addObject:image4];
    
    self.imageView.animationImages = mArr;
    i--;
    if (i<0)
    {
         i = 4;
    }
    int m = i % 5;
    self.imageView.image = mArr[m];
    self.label.text = [NSString stringWithFormat:@"%i/5",m+1];

}


@end
